$(document).ready(function () {
    init();
    colleven();
});

function colleven() {
    $("#collapseOne").on("show.bs.collapse", function () {
        $('#groupid2').parent().hide();
        $('#groupid3').parent().hide();
        $('#groupid4').parent().hide();
        $('#groupid5').parent().hide();
    });
    $("#collapseOne").on("hide.bs.collapse", function () {
        $('#groupid2').parent().show();
        $('#groupid3').parent().show();
        $('#groupid4').parent().show();
        $('#groupid5').parent().show();
    });
    $("#collapseTwo").on("show.bs.collapse", function () {
        $('#groupid1').parent().hide();
        $('#groupid3').parent().hide();
        $('#groupid4').parent().hide();
        $('#groupid5').parent().hide();
    });
    $("#collapseTwo").on("hide.bs.collapse", function () {
        $('#groupid1').parent().show();
        $('#groupid3').parent().show();
        $('#groupid4').parent().show();
        $('#groupid5').parent().show();
    });
    $("#collapseThree").on("show.bs.collapse", function () {
        $('#groupid1').parent().hide();
        $('#groupid2').parent().hide();
        $('#groupid4').parent().hide();
        $('#groupid5').parent().hide();
    });
    $("#collapseThree").on("hide.bs.collapse", function () {
        $('#groupid1').parent().show();
        $('#groupid2').parent().show();
        $('#groupid4').parent().show();
        $('#groupid5').parent().show();
    });
    $("#collapseFour").on("show.bs.collapse", function () {
        $('#groupid1').parent().hide();
        $('#groupid2').parent().hide();
        $('#groupid3').parent().hide();
        $('#groupid5').parent().hide();
    });
    $("#collapseFour").on("hide.bs.collapse", function () {
        $('#groupid1').parent().show();
        $('#groupid2').parent().show();
        $('#groupid3').parent().show();
        $('#groupid5').parent().show();
    });
    $("#collapseFive").on("show.bs.collapse", function () {
        $('#groupid1').parent().hide();
        $('#groupid2').parent().hide();
        $('#groupid3').parent().hide();
        $('#groupid4').parent().hide();
    });
    $("#collapseFive").on("hide.bs.collapse", function () {
        $('#groupid1').parent().show();
        $('#groupid2').parent().show();
        $('#groupid3').parent().show();
        $('#groupid4').parent().show();
    });
}

function formConfirm() {
    var cglxd = getUrlParam('requestid');
    getRwdId2Cglx(cglxd);
}

//显示采购立项列表
function cglxshow() {
    $('#zbqx').show();
    $('#zbgc').show();
    $('#wcjd').show();

    $('#jjzb').hide();
    $('#jjgc').hide();
}

//显示竞价立项列表
function jjlxshow() {
    $('#zbqx').hide();
    $('#zbgc').hide();

    $('#jjzb').show();
    $('#jjgc').show();
    $('#wcjd').show();
}

/*初始化*/
function init() {
    var cglxd = getUrlParam('requestid');
    $("#flushbtn").click(function () {
        location.reload(true);
    });
    if (cglxd > 0) {
        var datas = getZbcglxWfData(cglxd);
        if (datas.zbfs == '0') { //公开招标
            if (getcglxinfo(cglxd) == 3) {//采购招标立项
                getbspsinfo(cglxd);//标书评审
                getdycqinfo(cglxd);//答疑澄清
                if (getzbgginfo(cglxd) == 3) {//招标公告
                    if (getgysbminfo(cglxd) == 3) {//供应商报名
                        if (getzgysinfo(cglxd) == 3) {//资格预审
                            if (getdmdyqinfo(cglxd) == 3) {//短名单邀请
                                getonegystbinfo(cglxd, '1', "one");//供应商投标
                            }
                        }
                    }
                }
            }
        } else {
            $('#zbgg').hide();
            $('#gysbm').hide();
            if (getcglxinfo(cglxd) == 3) {//采购招标立项
                getbspsinfo(cglxd);//标书评审
                getdycqinfo(cglxd);//答疑澄清
                if (getzgysinfo(cglxd) == 3) {//资格预审
                    if (getdmdyqinfo(cglxd) == 3) {//短名单邀请
                        getonegystbinfo(cglxd, '1', "one");//供应商投标
                    }
                }
            }
        }
    }
    var data = getCglx2Jjlx(cglxd);
    var status = data.currentnodetype;
    var jjlxd = data.requestid;
    if (data.flag) {
        $('#jjlx').show();
        if (getjjlxinfo(jjlxd, status) == 3) {
            if (getgysyqinfo(cglxd) == 3) {
                if (getzxjjinfo(cglxd)) {
                    getbjmxinfo(cglxd);
                }
            }
        }
    }
}

/*采购立项*/
function getcglxinfo(cglxd) {
    var status = getCglxWfStatus(cglxd);
    var zbcglx_workflowid = getWorkflowid("zbcglx");
    $("#cglxbtn").attr("style", "display:block;");
    if (status == '') {
        var cglximg = "../images/begin.png";
        $('#cglxbtn').addClass('disabled'); //禁用 --变灰
    } else {
        var cglximg = status < 3 ? "../images/begin.png" : "../images/ok.png";
        var url = "/spa/workflow/static4form/index.html?#/main/workflow/req?workflowid=" + zbcglx_workflowid + "&requestid=" + cglxd + "&ismonitor=1";
        $("#cglxbtn1").attr("href", url);
    }
    $("#cglx").children("div").children("img").attr("src", cglximg);
    return status;
}

/*标书评审*/
function getbspsinfo(cglxd) {
    $("#bspsbtn").attr("style", "display:block;");
    $("#initbsps").remove();
    var datas = getCglxd2Status(cglxd, '', 'gysbsps');
    var gysbsps_workflowid = getWorkflowid("gysbsps");
    var cglxd_fieldid = getFieldid("gysbsps", "cglxd");
    var requestid = datas.requestid;
    var status = datas.currentnodetype;
    if (status == '') {
        var bspsimg = "../images/begin.png";
        var url = "/spa/workflow/static4form/index.html?#/main/workflow/req?iscreate=1&workflowid=" + gysbsps_workflowid + "&" + cglxd_fieldid + "=" + cglxd;
        $("#bspsbtn1").attr("href", url);
        $('#bspsbtn2').addClass('disabled'); //禁用 --变灰
    } else {
        var url = "/spa/workflow/static4form/index.html?#/main/workflow/req?workflowid=" + gysbsps_workflowid + "&requestid=" + requestid + "&ismonitor=1";
        var bspsimg = status < 3 ? "../images/begin.png" : "../images/ok.png";
        $('#bspsbtn1').addClass('disabled'); //禁用 --变灰
        $("#bspsbtn2").attr("href", url);
    }

    $("#bsps").children("div").children("img").attr("src", bspsimg);
    return status;
}

/*招标公告*/
function getzbgginfo(cglxd) {
    $("#zbggbtn").attr("style", "display:block;");
    $("#initzbgg").remove();
    var datas = getCglxd2Status(cglxd, '', 'zbfbgg');
    var zbfbgg_workflowid = getWorkflowid("zbfbgg");
    var cglxd_fieldid = getFieldid("zbfbgg", "cglxd");
    var zbfbgg_customid = "75577";
    var requestid = datas.requestid;
    var status = datas.currentnodetype;
    if (status == '') {
        var zbggimg = "../images/begin.png";
        var url = "/spa/workflow/static4form/index.html?#/main/workflow/req?iscreate=1&workflowid=" + zbfbgg_workflowid + "&" + cglxd_fieldid + "=" + cglxd;
        $("#zbggbtn1").attr("href", url);
        $('#zbggbtn2').addClass('disabled'); //禁用 --变灰
        $('#zbggbtn3').addClass('disabled'); //禁用 --变灰
    } else if (status == 3) {
        var zbggimg = "../images/ok.png";
        var newsrc = "/spa/cube/index.html#/main/cube/search?customid=" + zbfbgg_customid + "&cglxd=" + cglxd;
        var url = "/spa/workflow/static4form/index.html?#/main/workflow/req?iscreate=1&workflowid=" + zbfbgg_workflowid + "&" + cglxd_fieldid + "=" + cglxd;
        var data4 = getCglxd2Status(cglxd, 1, 'fqpb');
        var fqpbstatus = data4.currentnodetype;
        if (fqpbstatus != '') {
            $('#zbggbtn1').addClass('disabled'); //禁用 --变灰
            $('#zbggbtn2').addClass('disabled'); //禁用 --变灰
            $("#zbggbtn3").attr("data-index", newsrc);
        } else {
            $('#zbggbtn1').addClass('disabled'); //禁用 --变灰
            $("#zbggbtn2").attr("href", url);
            $("#zbggbtn3").attr("data-index", newsrc);
        }
    } else {
        var zbggimg = "../images/begin.png";
        var newsrc = "/spa/cube/index.html#/main/cube/search?customid=" + zbfbgg_customid + "&cglxd=" + cglxd;
        $('#zbggbtn1').addClass('disabled'); //禁用 --变灰
        $('#zbggbtn2').addClass('disabled'); //禁用 --变灰
        $("#zbggbtn3").attr("data-index", newsrc);
    }
    changeAttr();
    $("#zbgg").children("div").children("img").attr("src", zbggimg);
    return status;
}

/*供应商报名*/
function getgysbminfo(cglxd) {
    $("#gysbmbtn").attr("style", "display:block;");
    $("#initgysbm").remove();
    var datas = getCglxd2Status(cglxd, '', 'gysbm');
    var gysbm_customid = "75576";
    var status = datas.currentnodetype;
    var datas3 = getFbggData(cglxd);
    var endDate = datas3.bmjzsj;
    if (status == '') {
        var gysbmimg = "../images/begin.png";
        $("#endDateid").text(endDate);
    } else {
        var datas1 = getGysbmCounts(cglxd);
        var bmsl = datas1.counts;
        var gysbmimg = isThanCurDate(endDate) ? "../images/begin.png" : "../images/ok.png";
        var newsrc = "/spa/cube/index.html#/main/cube/search?customid=" + gysbm_customid + "&cglxd=" + cglxd;
        $("#gysbmbtn1").attr("data-index", newsrc);
        $("#gysbmbtn1").text(bmsl);
        $("#endDateid").text(endDate);
    }
    changeAttr();
    $("#gysbm").children("div").children("img").attr("src", gysbmimg);
    return status;
}

/*资格预审*/
function getzgysinfo(cglxd) {
    $("#zgysbtn").attr("style", "display:block;");
    $("#initzgys").remove();
    var datas = getCglxd2Status(cglxd, '', 'gyszgys');
    var gyszgys_workflowid = getWorkflowid("gyszgys");
    var cglxd_fieldid = getFieldid("gyszgys", "cglxd");
    var gyszgys_customid = "75584";
    var requestid = datas.requestid;
    var status = datas.currentnodetype;
    if (status == '') {
        var zgysimg = "../images/begin.png";
        var now = new Date();
        var curDate = now.getFullYear() + "-" + ((now.getMonth() + 1) < 10 ? "0" : "") + (now.getMonth() + 1) + "-"
            + (now.getDate() < 10 ? "0" : "") + now.getDate() + " " + (now.getHours() < 10 ? "0" : "") + now.getHours()
            + ":" + (now.getMinutes() < 10 ? "0" : "") + now.getMinutes();
        var datas3 = getFbggData(cglxd);
        var endDate = datas3.bmjzsj;
        if (endDate > curDate) {
            $('#zgysbtn1').addClass('disabled'); //禁用 --变灰
            $('#zgysbtn2').addClass('disabled'); //禁用 --变灰
        } else {
            var url = "/spa/workflow/static4form/index.html?#/main/workflow/req?iscreate=1&workflowid=" + gyszgys_workflowid + "&" + cglxd_fieldid + "=" + cglxd;
            $("#zgysbtn1").attr("href", url);
            $('#zgysbtn2').addClass('disabled'); //禁用 --变灰
            var zgysimg = "../images/begin.png";
        }
    } else if (status < 3) {
        var newsrc = "/spa/cube/index.html#/main/cube/search?customid=" + gyszgys_customid + "&cglxd=" + cglxd;
        var zgysimg = status < 3 ? "../images/begin.png" : "../images/ok.png";
        $('#zgysbtn1').addClass('disabled'); //禁用 --变灰
        $("#zgysbtn2").attr("data-index", newsrc);
    } else {
        var zgysimg = "../images/ok.png";
        var newsrc = "/spa/cube/index.html#/main/cube/search?customid=" + gyszgys_customid + "&cglxd=" + cglxd;
        var url = "/spa/workflow/static4form/index.html?#/main/workflow/req?iscreate=1&workflowid=" + gyszgys_workflowid + "&" + cglxd_fieldid + "=" + cglxd;
        var data4 = getCglxd2Status(cglxd, '', 'gysyq');
        var gysyqstatus = data4.currentnodetype;
        if (gysyqstatus == '') {
            $("#zgysbtn1").attr("href", url);
            $("#zgysbtn2").attr("data-index", newsrc);
        } else {
            $('#zgysbtn1').addClass('disabled'); //禁用 --变灰
            $("#zgysbtn2").attr("data-index", newsrc);
        }
    }
    changeAttr();
    $("#zgys").children("div").children("img").attr("src", zgysimg);
    return status;
}

/*短名单邀请*/
function getdmdyqinfo(cglxd) {
    $("#dmdyqbtn11").attr("style", "display:block;");
    $("#dmdyqbtn22").attr("style", "display:block;");
    $("#initdmdyq").remove();
    var datas = getCglxd2Status(cglxd, '', 'gysyq');
    var gysyq_workflowid = getWorkflowid("gysyq");
    var cglxd_fieldid = getFieldid("gysyq", "cglxd");
    var gysyq_customid1 = "75578";
    var gysyq_customid2 = "75594";
    var gysyq_customid3 = "75595";
    var requestid = datas.requestid;
    var status = datas.currentnodetype;
    if (status == '') {
        var data1 = getZgysDtlCounts(cglxd);
        var zgyscounts = data1.zgyscounts;
        var data2 = getZbcglxWfData(cglxd);
        var zdtbdws = data2.zdtbdws;
        if (zgyscounts >= zdtbdws) {
            var dmdyqimg = "../images/begin.png";
            var url = "/spa/workflow/static4form/index.html?#/main/workflow/req?iscreate=1&workflowid=" + gysyq_workflowid + "&" + cglxd_fieldid + "=" + cglxd;
            $("#dmdyqbtn1").attr("href", url);
            $('#dmdyqbtn2').addClass('disabled'); //禁用 --变灰
        } else {
            $('#dmdyqbtn1').addClass('disabled'); //禁用 --变灰
            $('#dmdyqbtn2').addClass('disabled'); //禁用 --变灰
        }
    } else {
        var data = getDmdyqCounts(cglxd);
        var totalCounts = data.totalCounts;
        var viewCounts = data.viewCounts;
        var compCounts = data.compCounts;
        var newsrc1 = "/spa/cube/index.html#/main/cube/search?customid=" + gysyq_customid1 + "&cglxd=" + cglxd;
        var newsrc2 = "/spa/cube/index.html#/main/cube/search?customid=" + gysyq_customid2 + "&cglxd=" + cglxd;
        var newsrc3 = "/spa/cube/index.html#/main/cube/search?customid=" + gysyq_customid3 + "&cglxd=" + cglxd;
        var url = "/spa/workflow/static4form/index.html?#/main/workflow/req?workflowid=" + gysyq_workflowid + "&requestid=" + requestid + "&ismonitor=1";
        var dmdyqimg = status < 3 ? "../images/begin.png" : "../images/ok.png";
        $("#dmdyqbtn3").attr("data-index", newsrc2);
        $("#dmdyqbtn3").text(viewCounts);
        $("#dmdyqbtn4").attr("data-index", newsrc1);
        $("#dmdyqbtn4").text(totalCounts);
        $("#dmdyqbtn5").attr("data-index", newsrc3);
        $("#dmdyqbtn5").text(compCounts);
        $("#dmdyqbtn6").attr("data-index", newsrc1);
        $("#dmdyqbtn6").text(totalCounts);
        $('#dmdyqbtn1').addClass('disabled'); //禁用 --变灰
        $("#dmdyqbtn2").attr("href", url);

    }
    changeAttr();
    $("#dmdyq").children("div").children("img").attr("src", dmdyqimg);
    return status;
}

/*答疑澄清*/
function getdycqinfo(cglxd) {
    $("#dycqbtn").attr("style", "display:block;");
    $("#initdycq").remove();
    var curstatus = '';
    var datas = getZbcglxWfData(cglxd);
    if (datas.zbfs == '0') { //公开招标
        if (getcglxinfo(cglxd) == 3) {//采购招标立项
            if (getbspsinfo(cglxd) != 3) {//标书评审
                curstatus = 1;
            }
            if (getzbgginfo(cglxd) == 3) {//招标公告
                if (getgysbminfo(cglxd) == 3) {//供应商报名
                    if (getzgysinfo(cglxd) == 3) {//资格预审
                        if (getdmdyqinfo(cglxd) == 3) {//短名单邀请
                            curstatus = getonegystb(cglxd, 1, "one");//供应商投标
                        } else {
                            curstatus = 5;
                        }
                    } else {
                        curstatus = 4;
                    }
                } else {
                    curstatus = 3;
                }
            } else {
                curstatus = 2;
            }
        } else {
            curstatus = 0;
        }
    } else {
        $('#zbgg').hide();
        $('#gysbm').hide();
        if (getcglxinfo(cglxd) == 3) {//采购招标立项
            if (getbspsinfo(cglxd) != 3) {//标书评审
                curstatus = 1;
            }
            if (getzgysinfo(cglxd) == 3) {//资格预审
                if (getdmdyqinfo(cglxd) == 3) {//短名单邀请
                    curstatus = getonegystb(cglxd, 1, "one");//供应商投标
                } else {
                    curstatus = 5;
                }
            } else {
                curstatus = 4;
            }
        } else {
            curstatus = 0;
        }
    }
    var now = new Date();
    var curDate = now.getFullYear() + "-" + ((now.getMonth() + 1) < 10 ? "0" : "") + (now.getMonth() + 1) + "-"
        + (now.getDate() < 10 ? "0" : "") + now.getDate() + " " + (now.getHours() < 10 ? "0" : "") + now.getHours()
        + ":" + (now.getMinutes() < 10 ? "0" : "") + now.getMinutes();
    var data = getFqpbTbjzrq(cglxd);
    var endDate = data.tbjzrq;
    var dycq_customid1 = "75582";
    var dycq_customid2 = "75583";
    var newsrc1 = "/spa/cube/index.html#/main/cube/search?customid=" + dycq_customid1 + "&cglxd=" + cglxd;
    var newsrc2 = "/spa/cube/index.html#/main/cube/search?customid=" + dycq_customid2 + "&cglxd=" + cglxd;
    if (endDate >= curDate) {
        var twgys_workflowid = getWorkflowid("twgys");
        var dycq_workflowid = getWorkflowid("dycq");
        var cglxd_twgys_fieldid = getFieldid("twgys", "cglxd");
        var cglxd_dycq_fieldid = getFieldid("dycq", "cglxd");
        var zcgcbz_dycq_fieldid = getFieldid("dycq", "zcgcbz");
        var url1 = "/spa/workflow/static4form/index.html?#/main/workflow/req?iscreate=1&workflowid=" + twgys_workflowid + "&" + cglxd_twgys_fieldid + "=" + cglxd;
        var url2 = "/spa/workflow/static4form/index.html?#/main/workflow/req?iscreate=1&workflowid=" + dycq_workflowid + "&" + cglxd_dycq_fieldid + "=" + cglxd + "&" + zcgcbz_dycq_fieldid + "=" + curstatus;

        $("#dycqbtn1").attr("href", url1);
        $("#dycqbtn2").attr("data-index", newsrc1);
        $("#dycqbtn3").attr("href", url2);
        $("#dycqbtn4").attr("data-index", newsrc2);

    } else {
        $("#dycqbtn1").addClass('disabled'); //禁用 --变灰
        $("#dycqbtn2").attr("data-index", newsrc1);
        $("#dycqbtn3").addClass('disabled'); //禁用 --变灰
        $("#dycqbtn4").attr("data-index", newsrc2);
    }
    changeAttr();
}

function getonegystb(cglxd, lc, btn) {
    var status = '';
    var datas = getCglxd2Status(cglxd, lc, 'fqpb');
    var fbstatus = datas.currentnodetype;
    var requestid = datas.requestid;
    if (fbstatus == '') {
        status = 6;
    } else if (fbstatus < 3) {
        status = 6;
    } else {
        var kbstatus = getkbData(cglxd, lc, btn);
        if (kbstatus == 3) {//3.开标
            var pbstatus = getpbData(cglxd, lc, btn);
            if (pbstatus == 3) { //4.评标
                var data = getCglxd2Status(cglxd, lc, 'pbjghq');
                var pbjgStatus = data.currentnodetype;
                if (pbjgStatus == 3) {
                    var data1 = getPbjghqData(cglxd, lc);
                    var xbcz = data1.xbcz;
                    if (xbcz == '0') {//转决策
                        if (getcgjcinfo(cglxd, lc) == 3) {//采购决策
                            status = 11;
                        } else {
                            status = 10;
                        }
                    } else if (xbcz == '2') {//转下一轮
                        status = gettwogystb(cglxd, 2, "two");
                    }
                } else {
                    status = 9;
                }
            } else {
                status = 9;
            }
        } else {
            status = 8;
        }
    }
    return status;
}

function gettwogystb(cglxd, lc, btn) {
    var datas = getCglxd2Status(cglxd, lc, 'fqpb');
    var status = '';
    var fbstatus = datas.currentnodetype;
    if (fbstatus == '') {
        status = 6;
    } else if (fbstatus < 3) {
        status = 6;
    } else {
        var kbstatus = getkbData(cglxd, lc, btn);
        if (kbstatus == 3) {//3.开标
            var pbstatus = getpbData(cglxd, lc, btn);
            if (pbstatus == 3) { //4.评标
                var data = getCglxd2Status(cglxd, lc, 'pbjghq');
                var pbjgStatus = data.currentnodetype;
                if (pbjgStatus == 3) {
                    var data1 = getPbjghqData(cglxd, lc);
                    var xbcz = data1.xbcz;
                    if (xbcz == '0') {//转决策
                        if (getcgjcinfo(cglxd, lc) == 3) {//采购决策
                            status = 11;
                        } else {
                            status = 10;
                        }
                    } else if (xbcz == '2') {//转下一轮
                        status = getthreegystb(cglxd, 3, "three");
                    }
                } else {
                    status = 9;
                }
            } else {
                status = 9;
            }
        } else {
            status = 8;
        }
    }
    return status;
}

function getthreegystb(cglxd, lc, btn) {
    var datas = getCglxd2Status(cglxd, lc, 'fqpb');
    var status = '';
    var fbstatus = datas.currentnodetype;
    var requestid = datas.requestid;
    if (fbstatus == '') {
        status = 6;
    } else if (fbstatus < 3) {
        status = 6;
    } else {
        var kbstatus = getkbData(cglxd, lc, btn);
        if (kbstatus == 3) {//3.开标
            var pbstatus = getpbData(cglxd, lc, btn);
            if (pbstatus == 3) { //4.评标
                var data = getCglxd2Status(cglxd, lc, 'pbjghq');
                var pbjgStatus = data.currentnodetype;
                if (pbjgStatus == 3) {
                    var data1 = getPbjghqData(cglxd, lc);
                    var xbcz = data1.xbcz;
                    if (xbcz == '0') {//转决策
                        if (getcgjcinfo(cglxd, lc) == 3) {//采购决策
                            status = 11;
                        } else {
                            status = 10;
                        }
                    } else if (xbcz == '2') {//转下一轮
                        status = getfourgystb(cglxd, 4, "four");
                    }
                } else {
                    status = 9;
                }
            } else {
                status = 9;
            }
        } else {
            status = 8;
        }
    }
    return status;
}

function getfourgystb(cglxd, lc, btn) {
    var datas = getCglxd2Status(cglxd, lc, 'fqpb');
    var status = '';
    var fbstatus = datas.currentnodetype;
    if (fbstatus == '') {
        status = 6;
    } else if (fbstatus < 3) {
        status = 6;
    } else {
        var kbstatus = getkbData(cglxd, lc, btn);
        if (getkbData(cglxd, lc, btn) == 3) {//3.开标
            var pbstatus = getpbData(cglxd, lc, btn);
            if (pbstatus == 3) { //4.评标
                var data = getCglxd2Status(cglxd, lc, 'pbjghq');
                var pbjgStatus = data.currentnodetype;
                if (pbjgStatus == 3) {
                    var data1 = getPbjghqData(cglxd, lc);
                    var xbcz = data1.xbcz;
                    if (xbcz == '0') {//转决策
                        if (getcgjcinfo(cglxd, lc) == 3) {//采购决策
                            status = 11;
                        } else {
                            status = 10;
                        }
                    } else if (xbcz == '2') {//转下一轮
                        status = getfivegystb(cglxd, 5, "five");
                    }
                } else {
                    status = 9;
                }
            } else {
                status = 9;
            }
        } else {
            status = 8;
        }
    }
    return status;
}

function getfivegystb(cglxd, lc, btn) {
    var datas = getCglxd2Status(cglxd, lc, 'fqpb');
    var status = '';
    var fbstatus = datas.currentnodetype;
    if (fbstatus == '') {
        status = 6;
    } else if (fbstatus < 3) {
        status = 6;
    } else {
        var kbstatus = getkbData(cglxd, lc, btn);
        if (kbstatus == 3) {//3.开标
            var pbstatus = getpbData(cglxd, lc, btn);
            if (pbstatus == 3) { //4.评标
                var data = getCglxd2Status(cglxd, lc, 'pbjghq');
                var pbjgStatus = data.currentnodetype;
                if (pbjgStatus == 3) {
                    var data1 = getPbjghqData(cglxd, lc);
                    var xbcz = data1.xbcz;
                    if (xbcz == '0') {//转决策
                        if (getcgjcinfo(cglxd, lc) == 3) {//采购决策
                            status = 11;
                        } else {
                            status = 10;
                        }
                    }
                } else {
                    status = 9;
                }
            } else {
                status = 9;
            }
        } else {
            status = 8;
        }
    }
    return status;
}

/*供应商投标第一轮*/
function getonegystbinfo(cglxd, lc, btn) {
    $("#" + btn + "gystbbtn").attr("style", "display:block;");
    $("#initgystb2").remove();
    var status = '';
    var datas = getCglxd2Status(cglxd, lc, 'fqpb');
    var fqpb_workflowid = getWorkflowid("fqpb");
    var cglxd_fieldid = getFieldid("fqpb", "cglxd");
    var fbstatus = datas.currentnodetype;
    var requestid = datas.requestid;
    if (fbstatus == '') {
        var gystbimg = "../images/begin.png";
        var data1 = getDmdyqCounts(cglxd);
        var compCounts = data1.compCounts;
        var data2 = getZbcglxWfData(cglxd);
        var zdtbdws = data2.zdtbdws;
        var bspsStatus = getbspsinfo(cglxd);
        if ((bspsStatus == 3) && (compCounts >= zdtbdws)) {
            var url = "/spa/workflow/static4form/index.html?#/main/workflow/req?iscreate=1&workflowid=" + fqpb_workflowid + "&" + cglxd_fieldid + "=" + cglxd + "&field144045=" + lc;
            $("#" + btn + "gystbbtn1").attr("href", url);
            $("#" + btn + "gystbbtn2").addClass('disabled'); //禁用 --变灰
        } else {
            $("#" + btn + "gystbbtn1").addClass('disabled'); //禁用 --变灰
            $("#" + btn + "gystbbtn2").addClass('disabled'); //禁用 --变灰
        }
        status = 6;
        $("#gystb").children("div").children("img").attr("src", gystbimg);
    } else if (fbstatus < 3) {
        var url = "/spa/workflow/static4form/index.html?#/main/workflow/req?workflowid=" + fqpb_workflowid + "&requestid=" + requestid + "&ismonitor=1";
        $("#" + btn + "gystbbtn1").addClass('disabled'); //禁用 --变灰
        $("#" + btn + "gystbbtn2").attr("href", url);
        status = 6;
    } else {
        var url = "/spa/workflow/static4form/index.html?#/main/workflow/req?workflowid=" + fqpb_workflowid + "&requestid=" + requestid + "&ismonitor=1";
        $("#" + btn + "fbbtn1").attr("href", url);
        $("#initgystb1").remove();
        $("#gystb").children(".img").remove();
        $('#gystb').children().eq(0).children('p').remove();
        $("#groupid1").attr("style", "display:block;width:200px;margin-bottom:1px;");

        //2.投标
        gettbData(cglxd, lc, btn);
        var kbstatus = getkbData(cglxd, lc, btn);
        if (kbstatus == 3) {//3.开标
            var pbstatus = getpbData(cglxd, lc, btn);
            if (pbstatus == 3) { //4.评标
                var data = getCglxd2Status(cglxd, lc, 'pbjghq');
                var pbjgStatus = data.currentnodetype;
                if (pbjgStatus == 3) {
                    var data1 = getPbjghqData(cglxd, lc);
                    var xbcz = data1.xbcz;
                    if (xbcz == '0') {//转决策
                        if (getcgjcinfo(cglxd, lc) == 3) {//采购决策
                            status = 11;
                        } else {
                            status = 10;
                        }
                    } else if (xbcz == '2') {//转下一轮
                        gettwogystbinfo(cglxd, '2', "two");
                    }
                } else {
                    status = 9;
                }
            } else {
                status = 9;
            }
        } else {
            status = 8;
            $("#" + btn + "pbbtn1").addClass('disabled'); //禁用 --变灰
            $("#" + btn + "pbbtn2").addClass('disabled'); //禁用 --变灰
            $("#" + btn + "pbbtn3").addClass('disabled'); //禁用 --变灰
            $("#" + btn + "pbbtn4").addClass('disabled'); //禁用 --变灰
            $("#" + btn + "pbbtn5").addClass('disabled'); //禁用 --变灰
        }
    }
    getzcxmlbinfo(cglxd);
    return status;
}

/*供应商投标第二轮*/
function gettwogystbinfo(cglxd, lc, btn) {
    $("#" + btn + "gystbbtn").attr("style", "display:block;");
    var datas = getCglxd2Status(cglxd, lc, 'fqpb');
    var fqpb_workflowid = getWorkflowid("fqpb");
    var cglxd_fieldid = getFieldid("fqpb", "cglxd");
    var status = '';
    var fbstatus = datas.currentnodetype;
    var requestid = datas.requestid;
    if (fbstatus == '') {
        var url = "/spa/workflow/static4form/index.html?#/main/workflow/req?iscreate=1&workflowid=" + fqpb_workflowid + "&" + cglxd_fieldid + "=" + cglxd + "&field144045=" + lc;
        $("#" + btn + "gystbbtn1").attr("href", url);
        $("#" + btn + "gystbbtn2").addClass('disabled'); //禁用 --变灰
        status = 6;
    } else if (fbstatus < 3) {
        var url = "/spa/workflow/static4form/index.html?#/main/workflow/req?iscreate=1&workflowid=" + fqpb_workflowid + "&requestid=" + requestid;
        $("#" + btn + "gystbbtn1").addClass('disabled'); //禁用 --变灰
        $("#" + btn + "gystbbtn2").attr("href", url);
        status = 6;
    } else {
        var url = "/spa/workflow/static4form/index.html?#/main/workflow/req?workflowid=" + fqpb_workflowid + "&requestid=" + requestid + "&ismonitor=1";
        $("#" + btn + "fbbtn1").attr("href", url);
        $("#groupid2").attr("style", "display:block;width:200px;margin-bottom:1px;");
        $("#" + btn + "gystbbtn").remove();
        //2.投标
        gettbData(cglxd, lc, btn);
        var kbstatus = getkbData(cglxd, lc, btn);
        if (kbstatus == 3) {//3.开标
            var pbstatus = getpbData(cglxd, lc, btn);
            if (pbstatus == 3) { //4.评标
                var data = getCglxd2Status(cglxd, lc, 'pbjghq');
                var pbjgStatus = data.currentnodetype;
                if (pbjgStatus == 3) {
                    var data1 = getPbjghqData(cglxd, lc);
                    var xbcz = data1.xbcz;
                    if (xbcz == '0') {//转决策
                        if (getcgjcinfo(cglxd, lc) == 3) {//采购决策
                            status = 11;
                        } else {
                            status = 10;
                        }
                    } else if (xbcz == '2') {//转下一轮
                        var newlc = 3;
                        getthreegystbinfo(cglxd, newlc, "three");
                    }
                } else {
                    status = 9;
                }
            } else {
                status = 9;
            }
        } else {
            status = 8;
            $("#" + btn + "pbbtn1").addClass('disabled'); //禁用 --变灰
            $("#" + btn + "pbbtn2").addClass('disabled'); //禁用 --变灰
            $("#" + btn + "pbbtn3").addClass('disabled'); //禁用 --变灰
            $("#" + btn + "pbbtn4").addClass('disabled'); //禁用 --变灰
            $("#" + btn + "pbbtn5").addClass('disabled'); //禁用 --变灰
        }
    }
    getzcxmlbinfo(cglxd);
    return status;
}

/*供应商投标第三轮*/
function getthreegystbinfo(cglxd, lc, btn) {
    $("#" + btn + "gystbbtn").attr("style", "display:block;");
    var datas = getCglxd2Status(cglxd, lc, 'fqpb');
    var fqpb_workflowid = getWorkflowid("fqpb");
    var cglxd_fieldid = getFieldid("fqpb", "cglxd");
    var status = '';
    var fbstatus = datas.currentnodetype;
    var requestid = datas.requestid;
    if (fbstatus == '') {
        var url = "/spa/workflow/static4form/index.html?#/main/workflow/req?iscreate=1&workflowid=" + fqpb_workflowid + "&" + cglxd_fieldid + "=" + cglxd + "&field144045=" + lc;
        $("#" + btn + "gystbbtn1").attr("href", url);
        $("#" + btn + "gystbbtn2").addClass('disabled'); //禁用 --变灰
        status = 6;
    } else if (fbstatus < 3) {
        var url = "/spa/workflow/static4form/index.html?#/main/workflow/req?iscreate=1&workflowid=" + fqpb_workflowid + "&requestid=" + requestid + "&ismonitor=1";
        $("#" + btn + "gystbbtn1").addClass('disabled'); //禁用 --变灰
        $("#" + btn + "gystbbtn2").attr("href", url);
        status = 6;
    } else {
        var url = "/spa/workflow/static4form/index.html?#/main/workflow/req?workflowid=" + fqpb_workflowid + "&requestid=" + requestid + "&ismonitor=1";
        $("#" + btn + "fbbtn1").attr("href", url);
        $("#groupid3").attr("style", "display:block;width:200px;margin-bottom:1px;");
        $("#" + btn + "gystbbtn").remove();
        //2.投标
        gettbData(cglxd, lc, btn);
        var kbstatus = getkbData(cglxd, lc, btn);
        if (kbstatus == 3) {//3.开标
            var pbstatus = getpbData(cglxd, lc, btn);
            if (pbstatus == 3) { //4.评标
                var data = getCglxd2Status(cglxd, lc, 'pbjghq');
                var pbjgStatus = data.currentnodetype;
                if (pbjgStatus == 3) {
                    var data1 = getPbjghqData(cglxd, lc);
                    var xbcz = data1.xbcz;
                    if (xbcz == '0') {//转决策
                        if (getcgjcinfo(cglxd, lc) == 3) {//采购决策
                            status = 11;
                        } else {
                            status = 10;
                        }
                    } else if (xbcz == '2') {//转下一轮
                        var newlc = 4;
                        getfourgystbinfo(cglxd, newlc, "four");
                    }
                } else {
                    status = 9;
                }
            } else {
                status = 9;
            }
        } else {
            status = 8;
            $("#" + btn + "pbbtn1").addClass('disabled'); //禁用 --变灰
            $("#" + btn + "pbbtn2").addClass('disabled'); //禁用 --变灰
            $("#" + btn + "pbbtn3").addClass('disabled'); //禁用 --变灰
            $("#" + btn + "pbbtn4").addClass('disabled'); //禁用 --变灰
            $("#" + btn + "pbbtn5").addClass('disabled'); //禁用 --变灰
        }
    }
    getzcxmlbinfo(cglxd);
    return status;
}

/*供应商投标第四轮*/
function getfourgystbinfo(cglxd, lc, btn) {
    $("#" + btn + "gystbbtn").attr("style", "display:block;");
    var datas = getCglxd2Status(cglxd, lc, 'fqpb');
    var fqpb_workflowid = getWorkflowid("fqpb");
    var cglxd_fieldid = getFieldid("fqpb", "cglxd");
    var status = '';
    var fbstatus = datas.currentnodetype;
    var requestid = datas.requestid;
    if (fbstatus == '') {
        var url = "/spa/workflow/static4form/index.html?#/main/workflow/req?iscreate=1&workflowid=" + fqpb_workflowid + "&" + cglxd_fieldid + "=" + cglxd + "&field144045=" + lc;
        $("#" + btn + "gystbbtn1").attr("href", url);
        $("#" + btn + "gystbbtn2").addClass('disabled'); //禁用 --变灰
        status = 6;
    } else if (fbstatus < 3) {
        var url = "/spa/workflow/static4form/index.html?#/main/workflow/req?iscreate=1&workflowid=" + fqpb_workflowid + "&requestid=" + requestid + "&ismonitor=1";
        $("#" + btn + "gystbbtn1").addClass('disabled'); //禁用 --变灰
        $("#" + btn + "gystbbtn2").attr("href", url);
        status = 6;
    } else {
        var url = "/spa/workflow/static4form/index.html?#/main/workflow/req?workflowid=" + fqpb_workflowid + "&requestid=" + requestid + "&ismonitor=1";
        $("#" + btn + "fbbtn1").attr("href", url);
        $("#groupid4").attr("style", "display:block;width:200px;margin-bottom:1px;");
        $("#" + btn + "gystbbtn").remove();
        //2.投标
        gettbData(cglxd, lc, btn);
        var kbstatus = getkbData(cglxd, lc, btn);
        if (getkbData(cglxd, lc, btn) == 3) {//3.开标
            var pbstatus = getpbData(cglxd, lc, btn);
            if (pbstatus == 3) { //4.评标
                var data = getCglxd2Status(cglxd, lc, 'pbjghq');
                var pbjgStatus = data.currentnodetype;
                if (pbjgStatus == 3) {
                    var data1 = getPbjghqData(cglxd, lc);
                    var xbcz = data1.xbcz;
                    if (xbcz == '0') {//转决策
                        if (getcgjcinfo(cglxd, lc) == 3) {//采购决策
                            status = 11;
                        } else {
                            status = 10;
                        }
                    } else if (xbcz == '2') {//转下一轮
                        var newlc = 5;
                        getfivegystbinfo(cglxd, newlc, "five");
                    }
                } else {
                    status = 9;
                }
            } else {
                status = 9;
            }
        } else {
            status = 8;
            $("#" + btn + "pbbtn1").addClass('disabled'); //禁用 --变灰
            $("#" + btn + "pbbtn2").addClass('disabled'); //禁用 --变灰
            $("#" + btn + "pbbtn3").addClass('disabled'); //禁用 --变灰
            $("#" + btn + "pbbtn4").addClass('disabled'); //禁用 --变灰
            $("#" + btn + "pbbtn5").addClass('disabled'); //禁用 --变灰
        }
    }
    getzcxmlbinfo(cglxd);
    return status;
}

/*供应商投标五轮*/
function getfivegystbinfo(cglxd, lc, btn) {
    $("#" + btn + "gystbbtn").attr("style", "display:block;");
    var datas = getCglxd2Status(cglxd, lc, 'fqpb');
    var fqpb_workflowid = getWorkflowid("fqpb");
    var cglxd_fieldid = getFieldid("fqpb", "cglxd");
    var status = '';
    var fbstatus = datas.currentnodetype;
    var requestid = datas.requestid;
    if (fbstatus == '') {
        var url = "/spa/workflow/static4form/index.html?#/main/workflow/req?iscreate=1&workflowid=" + fqpb_workflowid + "&" + cglxd_fieldid + "=" + cglxd + "&field144045=" + lc;
        $("#" + btn + "gystbbtn1").attr("href", url);
        $("#" + btn + "gystbbtn2").addClass('disabled'); //禁用 --变灰
        status = 6;
    } else if (fbstatus < 3) {
        var url = "/spa/workflow/static4form/index.html?#/main/workflow/req?iscreate=1&workflowid=" + fqpb_workflowid + "&requestid=" + requestid + "&ismonitor=1";
        $("#" + btn + "gystbbtn1").addClass('disabled'); //禁用 --变灰
        $("#" + btn + "gystbbtn2").attr("href", url);
        status = 6;
    } else {
        var url = "/spa/workflow/static4form/index.html?#/main/workflow/req?workflowid=" + fqpb_workflowid + "&requestid=" + requestid + "&ismonitor=1";
        $("#" + btn + "fbbtn1").attr("href", url);
        $("#groupid5").attr("style", "display:block;width:200px;margin-bottom:1px;");
        $("#" + btn + "gystbbtn").remove();
        //2.投标
        gettbData(cglxd, lc, btn);
        var kbstatus = getkbData(cglxd, lc, btn);
        if (kbstatus == 3) {//3.开标
            var pbstatus = getpbData(cglxd, lc, btn);
            if (pbstatus == 3) { //4.评标
                var data = getCglxd2Status(cglxd, lc, 'pbjghq');
                var pbjgStatus = data.currentnodetype;
                if (pbjgStatus == 3) {
                    var data1 = getPbjghqData(cglxd, lc);
                    var xbcz = data1.xbcz;
                    if (xbcz == '0') {//转决策
                        if (getcgjcinfo(cglxd, lc) == 3) {//采购决策
                            status = 11;
                        } else {
                            status = 10;
                        }
                    }
                } else {
                    status = 9;
                }
            } else {
                status = 9;
            }
        } else {
            status = 8;
            $("#" + btn + "pbbtn1").addClass('disabled'); //禁用 --变灰
            $("#" + btn + "pbbtn2").addClass('disabled'); //禁用 --变灰
            $("#" + btn + "pbbtn3").addClass('disabled'); //禁用 --变灰
            $("#" + btn + "pbbtn4").addClass('disabled'); //禁用 --变灰
            $("#" + btn + "pbbtn5").addClass('disabled'); //禁用 --变灰
        }
    }
    getzcxmlbinfo(cglxd);
    return status;
}

/*2.投标*/
function gettbData(cglxd, lc, btn) {
    var data = getCglxd2Status(cglxd, lc, 'kbjghq');
    var status = data.currentnodetype;
    var data1 = getGystbCounts(cglxd, lc);
    var totalCounts = data1.totalCounts;
    var viewCounts = data1.viewCounts;
    var compCounts = data1.compCounts;
    var data2 = getFqpbData(cglxd, lc);
    var tbjzrq = data2.tbjzrq;
    var kbjghq_customid1 = "75580";//全部
    var kbjghq_customid2 = "75597";//查看
    var kbjghq_customid3 = "75579";//回执
    var newsrc1 = "/spa/cube/index.html#/main/cube/search?customid=" + kbjghq_customid1 + "&cglxd=" + cglxd + "&lc=" + lc;
    var newsrc2 = "/spa/cube/index.html#/main/cube/search?customid=" + kbjghq_customid2 + "&cglxd=" + cglxd + "&lc=" + lc;
    var newsrc3 = "/spa/cube/index.html#/main/cube/search?customid=" + kbjghq_customid3 + "&cglxd=" + cglxd + "&lc=" + lc;
    $("#" + btn + "EndDateid").text(tbjzrq);
    $("#" + btn + "tbbtn1").text(viewCounts);
    $("#" + btn + "tbbtn2").text(totalCounts);
    $("#" + btn + "tbbtn3").text(compCounts);
    $("#" + btn + "tbbtn4").text(totalCounts);
    if (status == 3) {
        $("#" + btn + "tbbtn1").attr("data-index", newsrc2);
        $("#" + btn + "tbbtn2").attr("data-index", newsrc1);
        $("#" + btn + "tbbtn3").attr("data-index", newsrc3);
        $("#" + btn + "tbbtn4").attr("data-index", newsrc1);
    } else {
        $("#" + btn + "tbbtn1").addClass('disabled'); //禁用 --变灰
        $("#" + btn + "tbbtn2").attr("data-index", newsrc1);
        $("#" + btn + "tbbtn3").addClass('disabled'); //禁用 --变灰
        $("#" + btn + "tbbtn4").attr("data-index", newsrc1);
    }
}

/*3.开标*/
function getkbData(cglxd, lc, btn) {
    var status = '';
    var now = new Date();
    var curDate = now.getFullYear() + "-" + ((now.getMonth() + 1) < 10 ? "0" : "") + (now.getMonth() + 1) + "-"
        + (now.getDate() < 10 ? "0" : "") + now.getDate() + " " + (now.getHours() < 10 ? "0" : "") + now.getHours()
        + ":" + (now.getMinutes() < 10 ? "0" : "") + now.getMinutes();
    var data2 = getFqpbData(cglxd, lc);
    var endDate = data2.tbjzrq;
    if (endDate < curDate) {
        var data = getKbszMainData(cglxd, lc);
        var kbszstatus = data.currentnodetype;
        var requestid = data.requestid;
        var kbfs = data.kbfs;
        var kbsz_workflowid = getWorkflowid("kbsz");
        var cglxd_kbsz_fieldid = getFieldid("kbsz", "cglxd");
        var lc_kbsz_fieldid = getFieldid("kbsz", "lc");
        var kbjghq_workflowid = getWorkflowid("kbjghq");
        var cglxd_kbjghq_fieldid = getFieldid("kbjghq", "cglxd");
        var lc_kbjghq_fieldid = getFieldid("kbjghq", "lc");
        if (kbszstatus == '') {
            var url = "/spa/workflow/static4form/index.html?#/main/workflow/req?iscreate=1&workflowid=" + kbsz_workflowid + "&" + cglxd_kbsz_fieldid + "=" + cglxd + "&" + lc_kbsz_fieldid + "=" + lc;
            $("#" + btn + "kbbtn1").attr("href", url);
            $("#" + btn + "kbbtn2").addClass('disabled'); //禁用 --变灰
            $("#" + btn + "kbbtn3").addClass('disabled'); //禁用 --变灰
            $("#" + btn + "kbbtn4").addClass('disabled'); //禁用 --变灰
            $("#" + btn + "kbbtn5").addClass('disabled'); //禁用 --变灰
            $("#" + btn + "kbbtn6").addClass('disabled'); //禁用 --变灰
        } else if (kbszstatus < 3) {
            var url = "/spa/workflow/static4form/index.html?#/main/workflow/req?workflowid=" + kbsz_workflowid + "&requestid=" + requestid + "&ismonitor=1";
            $("#" + btn + "kbbtn1").addClass('disabled'); //禁用 --变灰
            $("#" + btn + "kbbtn2").attr("href", url); //禁用 --变灰
            $("#" + btn + "kbbtn3").addClass('disabled'); //禁用 --变灰
            $("#" + btn + "kbbtn4").addClass('disabled'); //禁用 --变灰
            $("#" + btn + "kbbtn5").addClass('disabled'); //禁用 --变灰
            $("#" + btn + "kbbtn6").addClass('disabled'); //禁用 --变灰
        } else {
            if (kbfs == 0) {//大厅开标
                var data1 = getCglxd2Status(cglxd, lc, 'kbjghq');
                var requestid1 = data1.requestid;
                status = data1.currentnodetype;
                var url1 = "/spa/workflow/static4form/index.html?#/main/workflow/req?workflowid=" + kbsz_workflowid + "&requestid=" + requestid + "&ismonitor=1";
                var url2 = "/interface/cese/duss/bidOpenHall/index.html#/?cglxd=" + cglxd;
                var url3 = "/spa/workflow/static4form/index.html?#/main/workflow/req?workflowid=" + kbjghq_workflowid + "&requestid=" + requestid1 + "&ismonitor=1";
                if (status == '') {
                    $("#" + btn + "kbbtn1").addClass('disabled'); //禁用 --变灰
                    $("#" + btn + "kbbtn2").attr("href", url1); //禁用 --变灰
                    $("#" + btn + "kbbtn3").attr("href", url2);
                    $("#" + btn + "kbbtn4").addClass('disabled'); //禁用 --变灰
                    $("#" + btn + "kbbtn5").addClass('disabled'); //禁用 --变灰
                    $("#" + btn + "kbbtn6").addClass('disabled'); //禁用 --变灰
                } else {
                    $("#" + btn + "kbbtn1").addClass('disabled'); //禁用 --变灰
                    $("#" + btn + "kbbtn2").attr("href", url1); //禁用 --变灰
                    $("#" + btn + "kbbtn3").attr("href", url2);
                    $("#" + btn + "kbbtn4").attr("href", url3);
                    $("#" + btn + "kbbtn5").addClass('disabled'); //禁用 --变灰
                    $("#" + btn + "kbbtn6").addClass('disabled'); //禁用 --变灰
                }
            } else {//直接开标
                var data1 = getCglxd2Status(cglxd, lc, 'kbjghq');
                var requestid1 = data1.requestid;
                status = data1.currentnodetype;
                if (status == '') {
                    var url = "/spa/workflow/static4form/index.html?#/main/workflow/req?workflowid=" + kbsz_workflowid + "&requestid=" + requestid + "&ismonitor=1";
                    var url1 = "/spa/workflow/static4form/index.html?#/main/workflow/req?iscreate=1&workflowid=" + kbjghq_workflowid + "&" + cglxd_kbjghq_fieldid + "=" + cglxd + "&" + lc_kbjghq_fieldid + "=" + lc;
                    $("#" + btn + "kbbtn1").addClass('disabled'); //禁用 --变灰
                    $("#" + btn + "kbbtn2").attr("href", url); //禁用 --变灰
                    $("#" + btn + "kbbtn3").addClass('disabled'); //禁用 --变灰
                    $("#" + btn + "kbbtn4").addClass('disabled'); //禁用 --变灰
                    $("#" + btn + "kbbtn5").attr("href", url1);
                    $("#" + btn + "kbbtn6").addClass('disabled'); //禁用 --变灰
                } else {
                    var url = "/spa/workflow/static4form/index.html?#/main/workflow/req?workflowid=" + kbsz_workflowid + "&requestid=" + requestid + "&ismonitor=1";
                    var url1 = "/spa/workflow/static4form/index.html?#/main/workflow/req?workflowid=" + kbjghq_workflowid + "&requestid=" + requestid1 + "&ismonitor=1";
                    $("#" + btn + "kbbtn1").addClass('disabled'); //禁用 --变灰
                    $("#" + btn + "kbbtn2").attr("href", url); //禁用 --变灰
                    $("#" + btn + "kbbtn3").addClass('disabled');
                    $("#" + btn + "kbbtn4").addClass('disabled'); //禁用 --变灰
                    $("#" + btn + "kbbtn5").addClass('disabled'); //禁用 --变灰
                    $("#" + btn + "kbbtn6").attr("href", url1);
                }
            }
        }
    } else {
        $("#" + btn + "kbbtn1").addClass('disabled'); //禁用 --变灰
        $("#" + btn + "kbbtn2").addClass('disabled'); //禁用 --变灰
        $("#" + btn + "kbbtn3").addClass('disabled'); //禁用 --变灰
        $("#" + btn + "kbbtn4").addClass('disabled'); //禁用 --变灰
        $("#" + btn + "kbbtn5").addClass('disabled'); //禁用 --变灰
        $("#" + btn + "kbbtn6").addClass('disabled'); //禁用 --变灰
    }
    return status;
}

/*4.评标*/
function getpbData(cglxd, lc, btn) {
    var status = '';
    var data3 = getCglxd2Status(cglxd, lc, 'zxpbdf');
    var zxpbdf_workflowid = getWorkflowid("zxpbdf");
    var cglxd_zxpbdf_fieldid = getFieldid("zxpbdf", "cglxd");
    var lc_zxpbdf_fieldid = getFieldid("zxpbdf", "lc");
    var pbfs_zxpbdf_fieldid = getFieldid("zxpbdf", "pbfs");
    var requestid = data3.requestid;
    var zxpbStatus = data3.currentnodetype;
    var data4 = getFqpbData(cglxd, lc);
    var pbfs = data4.pbfs;
    var zhpbswgz = data4.zhpbswgz;
    if ((pbfs == '0' && zhpbswgz == '2') || pbfs == '1') {
        $("#" + btn + "pbbtn1").addClass('disabled'); //禁用 --变灰
        $("#" + btn + "pbbtn2").addClass('disabled'); //禁用 --变灰
        $("#" + btn + "pbbtn3").addClass('disabled'); //禁用 --变灰
        var data4 = getCglxd2Status(cglxd, lc, 'pbjghq');
        var pbjghq_workflowid = getWorkflowid("pbjghq");
        var cglxd_pbjghq_fieldid = getFieldid("pbjghq", "cglxd");
        var lc_pbjghq_fieldid = getFieldid("pbjghq", "lc");
        var pbfs_pbjghq_fieldid = getFieldid("pbjghq", "pbfs");
        var cglx_pbjghq_fieldid = getFieldid("pbjghq", "cglx");
        var requestid1 = data4.requestid;
        var pbjgStatus = data4.currentnodetype;
        if (pbjgStatus == '') {
            var data = getFqpbData(cglxd, lc);
            var cglx = data.cglx;
            if (pbfs == 0) {
                var data = getDfbData(cglxd, lc);
                var dfbcounts = data.dfbcounts;
                var zxpfcounts = data.zxpfcounts;
                if (dfbcounts == zxpfcounts) {
                    var newsrc = "/spa/cube/index.html#/main/cube/search?customid=75596&cglxd=" + cglxd + "&lc=" + lc;
                    var url1 = "/spa/workflow/static4form/index.html?#/main/workflow/req?workflowid=" + zxpbdf_workflowid + "&requestid=" + requestid;
                    var url2 = "/spa/workflow/static4form/index.html?#/main/workflow/req?iscreate=1&workflowid=" + pbjghq_workflowid + "&"
                        + cglxd_pbjghq_fieldid + "=" + cglxd + "&" + lc_pbjghq_fieldid + "=" + lc + "&" + cglx_pbjghq_fieldid + "=" + cglx + "&" + pbfs_pbjghq_fieldid + "=" + pbfs;
                    $("#" + btn + "pbbtn1").addClass('disabled'); //禁用 --变灰
                    $("#" + btn + "pbbtn2").attr("href", url1);
                    $("#" + btn + "pbbtn3").attr("data-index", newsrc);
                    $("#" + btn + "pbbtn4").attr("href", url2);
                    $("#" + btn + "pbbtn5").addClass('disabled'); //禁用 --变灰
                } else {
                    var newsrc = "/spa/cube/index.html#/main/cube/search?customid=75596&cglxd=" + cglxd + "&lc=" + lc;
                    var url = "/spa/workflow/static4form/index.html?#/main/workflow/req?workflowid=" + zxpbdf_workflowid + "&requestid=" + requestid + "&ismonitor=1";
                    $("#" + btn + "pbbtn1").addClass('disabled'); //禁用 --变灰
                    $("#" + btn + "pbbtn2").attr("href", url);
                    $("#" + btn + "pbbtn3").attr("data-index", newsrc);
                    $("#" + btn + "pbbtn4").addClass('disabled'); //禁用 --变灰
                    $("#" + btn + "pbbtn5").addClass('disabled'); //禁用 --变灰
                }
            } else {
                var newsrc = "/spa/cube/index.html#/main/cube/search?customid=75596&cglxd=" + cglxd + "&lc=" + lc;
                var url1 = "/spa/workflow/static4form/index.html?#/main/workflow/req?workflowid=" + zxpbdf_workflowid + "&requestid=" + requestid + "&ismonitor=1";
                var url2 = "/spa/workflow/static4form/index.html?#/main/workflow/req?iscreate=1&workflowid="
                    + pbjghq_workflowid + "&" + cglxd_pbjghq_fieldid + "=" + cglxd + "&" + lc_pbjghq_fieldid + "=" + lc + "&" + cglx_pbjghq_fieldid + "=" + cglx + "&" + pbfs_pbjghq_fieldid + "=" + pbfs;
                $("#" + btn + "pbbtn1").addClass('disabled'); //禁用 --变灰
                $("#" + btn + "pbbtn2").attr("href", url1);
                $("#" + btn + "pbbtn3").attr("data-index", newsrc);
                $("#" + btn + "pbbtn4").attr("href", url2);
                $("#" + btn + "pbbtn5").addClass('disabled'); //禁用 --变灰
            }
            status = pbjgStatus;
        } else {
            var newsrc = "/spa/cube/index.html#/main/cube/search?customid=75596&cglxd=" + cglxd + "&lc=" + lc;
            var url1 = "/spa/workflow/static4form/index.html?#/main/workflow/req?workflowid=" + zxpbdf_workflowid + "&requestid=" + requestid + "&ismonitor=1";
            var url2 = "/spa/workflow/static4form/index.html?#/main/workflow/req?workflowid=" + pbjghq_workflowid + "&requestid=" + requestid1 + "&ismonitor=1";
            $("#" + btn + "pbbtn1").addClass('disabled'); //禁用 --变灰
            $("#" + btn + "pbbtn2").attr("href", url1);
            $("#" + btn + "pbbtn3").attr("data-index", newsrc);
            $("#" + btn + "pbbtn4").addClass('disabled'); //禁用 --变灰
            $("#" + btn + "pbbtn5").attr("href", url2);
            status = pbjgStatus;
        }
    } else {
        if (zxpbStatus == '') {
            var now = new Date();
            var curDate = now.getFullYear() + "-" + ((now.getMonth() + 1) < 10 ? "0" : "") + (now.getMonth() + 1) + "-"
                + (now.getDate() < 10 ? "0" : "") + now.getDate() + " " + (now.getHours() < 10 ? "0" : "") + now.getHours()
                + ":" + (now.getMinutes() < 10 ? "0" : "") + now.getMinutes();
            var data2 = getFqpbData(cglxd, lc);
            var endDate = data2.tbjzrq;
            if (endDate < curDate) {
                var url = "/spa/workflow/static4form/index.html?#/main/workflow/req?iscreate=1&workflowid=" + zxpbdf_workflowid + "&" + cglxd_zxpbdf_fieldid + "="
                    + cglxd + "&" + lc_zxpbdf_fieldid + "=" + lc + "&" + pbfs_zxpbdf_fieldid + "=" + pbfs;
                $("#" + btn + "pbbtn1").attr("href", url);
                $("#" + btn + "pbbtn2").addClass('disabled'); //禁用 --变灰
                $("#" + btn + "pbbtn3").addClass('disabled'); //禁用 --变灰
                $("#" + btn + "pbbtn4").addClass('disabled'); //禁用 --变灰
                $("#" + btn + "pbbtn5").addClass('disabled'); //禁用 --变灰
            } else {
                $("#" + btn + "pbbtn1").addClass('disabled'); //禁用 --变灰
                $("#" + btn + "pbbtn2").addClass('disabled'); //禁用 --变灰
                $("#" + btn + "pbbtn3").addClass('disabled'); //禁用 --变灰
                $("#" + btn + "pbbtn4").addClass('disabled'); //禁用 --变灰
                $("#" + btn + "pbbtn5").addClass('disabled'); //禁用 --变灰
            }
            status = zxpbStatus;
        } else if (zxpbStatus < 3) {
            var url = "/spa/workflow/static4form/index.html?#/main/workflow/req?workflowid=" + zxpbdf_workflowid + "&requestid=" + requestid + "&ismonitor=1";
            $("#" + btn + "pbbtn1").addClass('disabled'); //禁用 --变灰
            $("#" + btn + "pbbtn2").attr("href", url);
            $("#" + btn + "pbbtn3").addClass('disabled'); //禁用 --变灰
            $("#" + btn + "pbbtn4").addClass('disabled'); //禁用 --变灰
            $("#" + btn + "pbbtn5").addClass('disabled'); //禁用 --变灰
            status = zxpbStatus;
        } else {
            var data4 = getCglxd2Status(cglxd, lc, 'pbjghq');
            var pbjghq_workflowid = getWorkflowid("pbjghq");
            var cglxd_pbjghq_fieldid = getFieldid("pbjghq", "cglxd");
            var lc_pbjghq_fieldid = getFieldid("pbjghq", "lc");
            var pbfs_pbjghq_fieldid = getFieldid("pbjghq", "pbfs");
            var cglx_pbjghq_fieldid = getFieldid("pbjghq", "cglx");
            var requestid1 = data4.requestid;
            var pbjgStatus = data4.currentnodetype;
            if (pbjgStatus == '') {
                var data = getFqpbData(cglxd, lc);
                var cglx = data.cglx;
                if (pbfs == 0) {
                    var data = getDfbData(cglxd, lc);
                    var dfbcounts = data.dfbcounts;
                    var zxpfcounts = data.zxpfcounts;
                    if (dfbcounts == zxpfcounts) {
                        var newsrc = "/spa/cube/index.html#/main/cube/search?customid=75596&cglxd=" + cglxd + "&lc=" + lc;
                        var url1 = "/spa/workflow/static4form/index.html?#/main/workflow/req?workflowid=" + zxpbdf_workflowid + "&requestid=" + requestid;
                        var url2 = "/spa/workflow/static4form/index.html?#/main/workflow/req?iscreate=1&workflowid=" + pbjghq_workflowid + "&"
                            + cglxd_pbjghq_fieldid + "=" + cglxd + "&" + lc_pbjghq_fieldid + "=" + lc + "&" + cglx_pbjghq_fieldid + "=" + cglx + "&" + pbfs_pbjghq_fieldid + "=" + pbfs;
                        $("#" + btn + "pbbtn1").addClass('disabled'); //禁用 --变灰
                        $("#" + btn + "pbbtn2").attr("href", url1);
                        $("#" + btn + "pbbtn3").attr("data-index", newsrc);
                        $("#" + btn + "pbbtn4").attr("href", url2);
                        $("#" + btn + "pbbtn5").addClass('disabled'); //禁用 --变灰
                    } else {
                        var newsrc = "/spa/cube/index.html#/main/cube/search?customid=75596&cglxd=" + cglxd + "&lc=" + lc;
                        var url = "/spa/workflow/static4form/index.html?#/main/workflow/req?workflowid=" + zxpbdf_workflowid + "&requestid=" + requestid + "&ismonitor=1";
                        $("#" + btn + "pbbtn1").addClass('disabled'); //禁用 --变灰
                        $("#" + btn + "pbbtn2").attr("href", url);
                        $("#" + btn + "pbbtn3").attr("data-index", newsrc);
                        $("#" + btn + "pbbtn4").addClass('disabled'); //禁用 --变灰
                        $("#" + btn + "pbbtn5").addClass('disabled'); //禁用 --变灰
                    }
                } else {
                    var newsrc = "/spa/cube/index.html#/main/cube/search?customid=75596&cglxd=" + cglxd + "&lc=" + lc;
                    var url1 = "/spa/workflow/static4form/index.html?#/main/workflow/req?workflowid=" + zxpbdf_workflowid + "&requestid=" + requestid + "&ismonitor=1";
                    var url2 = "/spa/workflow/static4form/index.html?#/main/workflow/req?iscreate=1&workflowid="
                        + pbjghq_workflowid + "&" + cglxd_pbjghq_fieldid + "=" + cglxd + "&" + lc_pbjghq_fieldid + "=" + lc + "&" + cglx_pbjghq_fieldid + "=" + cglx + "&" + pbfs_pbjghq_fieldid + "=" + pbfs;
                    $("#" + btn + "pbbtn1").addClass('disabled'); //禁用 --变灰
                    $("#" + btn + "pbbtn2").attr("href", url1);
                    $("#" + btn + "pbbtn3").attr("data-index", newsrc);
                    $("#" + btn + "pbbtn4").attr("href", url2);
                    $("#" + btn + "pbbtn5").addClass('disabled'); //禁用 --变灰
                }
                status = pbjgStatus;
            } else {
                var newsrc = "/spa/cube/index.html#/main/cube/search?customid=75596&cglxd=" + cglxd + "&lc=" + lc;
                var url1 = "/spa/workflow/static4form/index.html?#/main/workflow/req?workflowid=" + zxpbdf_workflowid + "&requestid=" + requestid + "&ismonitor=1";
                var url2 = "/spa/workflow/static4form/index.html?#/main/workflow/req?workflowid=" + pbjghq_workflowid + "&requestid=" + requestid1 + "&ismonitor=1";
                $("#" + btn + "pbbtn1").addClass('disabled'); //禁用 --变灰
                $("#" + btn + "pbbtn2").attr("href", url1);
                $("#" + btn + "pbbtn3").attr("data-index", newsrc);
                $("#" + btn + "pbbtn4").addClass('disabled'); //禁用 --变灰
                $("#" + btn + "pbbtn5").attr("href", url2);
                status = pbjgStatus;
            }
        }
    }
    return status;
}

/*采购决策*/
function getcgjcinfo(cglxd, lc) {
    $("#cgjcbtn").attr("style", "display:block;");
    $("#initcgjc").remove();
    var datas = getCglxd2Status(cglxd, lc, 'gyqfqjc');
    var gyqfqjc_workflowid = getWorkflowid("gyqfqjc");
    var cglxd_gyqfqjc_fieldid = getFieldid("gyqfqjc", "cglxd");
    var lc_gyqfqjc_fieldid = getFieldid("gyqfqjc", "lc");
    var cglx_gyqfqjc_fieldid = getFieldid("gyqfqjc", "cglx");

    var gysjcbg_workflowid = getWorkflowid("gysjcbg");
    var cglxd_gysjcbg_fieldid = getFieldid("gysjcbg", "cglxd");
    var lc_gysjcbg_fieldid = getFieldid("gysjcbg", "lc");
    var cglx_gysjcbg_fieldid = getFieldid("gysjcbg", "cglx");
    var status = datas.currentnodetype;
    var requestid = datas.requestid;
    var data = getFqpbData(cglxd, lc);
    var cglx = data.cglx;
    if (status == '') {
        var url = "/spa/workflow/static4form/index.html?#/main/workflow/req?iscreate=1&workflowid=" + gyqfqjc_workflowid + "&" + cglxd_gyqfqjc_fieldid + "=" + cglxd + "&" + lc_gyqfqjc_fieldid + "=" + lc + "&" + cglx_gyqfqjc_fieldid + "=" + cglx;
        $('#cgjcbtn1').removeClass('disabled');
        $("#cgjcbtn1").attr("href", url);
        $("#cgjcbtn2").addClass('disabled'); //禁用 --变灰
        $("#cgjcbtn3").addClass('disabled'); //禁用 --变灰
        $("#cgjcbtn4").addClass('disabled'); //禁用 --变灰
    } else if (status < 3) {
        var newsrc1 = "/spa/cube/index.html#/main/cube/search?customid=75593&cglxd=" + cglxd;
        $("#cgjcbtn1").addClass('disabled'); //禁用 --变灰
        $("#cgjcbtn2").attr("data-index", newsrc1);
        $("#cgjcbtn3").addClass('disabled'); //禁用 --变灰
        $("#cgjcbtn4").addClass('disabled'); //禁用 --变灰
    } else {
        var newsrc1 = "/spa/cube/index.html#/main/cube/search?customid=75593&cglxd=" + cglxd;
        var url2 = "/spa/workflow/static4form/index.html?#/main/workflow/req?iscreate=1&workflowid=" + gysjcbg_workflowid + "&" + cglxd_gysjcbg_fieldid + "=" + cglxd + "&" + lc_gysjcbg_fieldid + "=" + lc + "&" + cglx_gysjcbg_fieldid + "=" + cglx;
        var newsrc2 = "/spa/cube/index.html#/main/cube/search?customid=75585&cglxd=" + cglxd;
        $("#cgjcbtn1").addClass('disabled'); //禁用 --变灰
        $("#cgjcbtn2").attr("data-index", newsrc1);
        $("#cgjcbtn3").attr("href", url2);
        $("#cgjcbtn4").attr("data-index", newsrc2);
        var data1 = getFqjcData(cglxd, lc);
        if (data1.xbcz == '0') {
            getzbtzinfo(cglxd);//中标通知
        } else if (data1.xbcz == '2') {//转下一轮
            if (lc == '1') {
                gettwogystbinfo(cglxd, '2', "two");
            } else if (lc == '2') {
                getthreegystbinfo(cglxd, '3', "three");
            } else if (lc == '3') {
                getfourgystbinfo(cglxd, '4', "four");
            } else if (lc == '4') {
                getfivegystbinfo(cglxd, '5', "five");
            }
        }
    }
    changeAttr();
    var cgjcimg = status == 3 ? "../images/ok.png" : "../images/begin.png";
    $("#cgjc").children("div").children("img").attr("src", cgjcimg);
    return status;
}

/*中标通知*/
function getzbtzinfo(cglxd) {
    $("#zbtzbtn").attr("style", "display:block;");
    $("#initzbtz").remove();
    var newsrc = "/spa/cube/index.html#/main/cube/search?customid=75581&cglxd=" + cglxd;
    $("#zbtzbtn1").attr("data-index", newsrc);
}

/*流标*/
function getzcxmlbinfo(cglxd) {
    var datas = getZbcglxWfData(cglxd);
    var xmzt = datas.xmzt;
    if (xmzt == 2) {
        $('#zbggbtn2').addClass('disabled'); //禁用 --变灰
        $('#zgysbtn1').addClass('disabled'); //禁用 --变灰
        $('#dmdyqbtn1').addClass('disabled'); //禁用 --变灰
        $('#dycqbtn1').addClass('disabled'); //禁用 --变灰
        $('#dycqbtn3').addClass('disabled'); //禁用 --变灰
        $('#onegystbbtn1').addClass('disabled'); //禁用 --变灰
        $('#twogystbbtn1').addClass('disabled'); //禁用 --变灰
        $('#threegystbbtn1').addClass('disabled'); //禁用 --变灰
        $('#fourgystbbtn1').addClass('disabled'); //禁用 --变灰
        $('#fivegystbbtn1').addClass('disabled'); //禁用 --变灰
        $('#onekbbtn5').addClass('disabled'); //禁用 --变灰
        $('#twokbbtn5').addClass('disabled'); //禁用 --变灰
        $('#threekbbtn5').addClass('disabled'); //禁用 --变灰
        $('#fourkbbtn5').addClass('disabled'); //禁用 --变灰
        $('#fivekbbtn5').addClass('disabled'); //禁用 --变灰
        $('#threekbbtn5').addClass('disabled'); //禁用 --变灰
        $('#onepbbtn1').addClass('disabled'); //禁用 --变灰
        $('#twopbbtn1').addClass('disabled'); //禁用 --变灰
        $('#threepbbtn1').addClass('disabled'); //禁用 --变灰
        $('#fourpbbtn1').addClass('disabled'); //禁用 --变灰
        $('#fivepbbtn1').addClass('disabled'); //禁用 --变灰
        $('#onepbbtn4').addClass('disabled'); //禁用 --变灰
        $('#twopbbtn4').addClass('disabled'); //禁用 --变灰
        $('#threepbbtn4').addClass('disabled'); //禁用 --变灰
        $('#fourpbbtn4').addClass('disabled'); //禁用 --变灰
        $('#fivepbbtn4').addClass('disabled'); //禁用 --变灰
        $('#cgjcbtn1').addClass('disabled'); //禁用 --变灰
        $('#cgjcbtn3').addClass('disabled'); //禁用 --变灰
    }
}

//获取url地址参数
function getUrlParam(name) {
    var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)"); //构造一个含有目标参数的正则表达式对象
    var r = window.location.search.substr(1).match(reg);  //匹配目标参数
    if (r != null) return unescape(r[2]);
    return null; //返回参数值
}

//采购立项单转流程cglxd
function getCglxd2Status(cglxd, lc, table) {
    var datas = {};
    if (cglxd != '') {
        $.ajax({
            async: false,
            url: '/api/weaWorkflowActionApi/getCglxd2Status',
            data: {cglxd: cglxd, lc: lc, table: table},
            type: "get",
            dataType: "json",
            success: function (data) {
                datas = data.datas;
            }, error: function (e) {
            }
        });
    }
    return datas;
}

//获取招标采购立项流程招标方式
function getZbcglxWfData(cglxd) {
    var datas = {};
    if (cglxd != '') {
        $.ajax({
            async: false,
            url: '/api/weaWorkflowActionApi/getZbcglxWfData',
            data: {cglxd: cglxd},
            type: "get",
            dataType: "json",
            success: function (data) {
                datas = data.datas;
            }, error: function (e) {
            }
        });
    }
    return datas;
}

//获取供应商报名个数
function getGysbmCounts(cglxd) {
    var datas = {};
    if (cglxd != '') {
        $.ajax({
            async: false,
            url: '/api/weaWorkflowActionApi/getGysbmCounts',
            data: {cglxd: cglxd},
            type: "get",
            dataType: "json",
            success: function (data) {
                datas = data.datas;
            }, error: function (e) {
            }
        });
    }
    return datas;
}

//获取短名单邀请回执个数，查看邀请回执各个数，回执完成个数
function getDmdyqCounts(cglxd) {
    var datas = {};
    if (cglxd != '') {
        $.ajax({
            async: false,
            url: '/api/weaWorkflowActionApi/getDmdyqCounts',
            data: {cglxd: cglxd},
            type: "get",
            dataType: "json",
            success: function (data) {
                datas = data.datas;
            }, error: function (e) {
            }
        });
    }
    return datas;
}

//获取供应商投标回执个数，查看邀请回执各个数，回执完成个数
function getGystbCounts(cglxd, lc) {
    var datas = {};
    if (cglxd != '') {
        $.ajax({
            async: false,
            url: '/api/weaWorkflowActionApi/getGystbCounts',
            data: {cglxd: cglxd, lc: lc},
            type: "get",
            dataType: "json",
            success: function (data) {
                datas = data.datas;
            }, error: function (e) {
            }
        });
    }
    return datas;
}

//修改提示框属性
function changeAttr() {
    $('#myModal').on('show.bs.modal', function (e) {
        $("#modalid").children('iframe').attr('src', e.relatedTarget.dataset.index);
    })
}

//获取发布公告时间
function getFbggData(cglxd) {
    var datas = {};
    if (cglxd != '') {
        $.ajax({
            async: false,
            url: '/api/weaWorkflowActionApi/getFbggData',
            data: {cglxd: cglxd},
            type: "get",
            dataType: "json",
            success: function (data) {
                datas = data.datas;
            }, error: function (e) {
            }
        });
    }
    return datas;
}

//根据采购立项单、轮次获取发布公告时间
function getFqpbData(cglxd, lc) {
    var datas = {};
    if (cglxd != '') {
        $.ajax({
            async: false,
            url: '/api/weaWorkflowActionApi/getFqpbData',
            data: {cglxd: cglxd, lc: lc},
            type: "get",
            dataType: "json",
            success: function (data) {
                datas = data.datas;
            }, error: function (e) {
            }
        });
    }
    return datas;
}

//根据采购立项单、轮次获取投标截止时间
function getFqpbTbjzrq(cglxd) {
    var datas = {};
    if (cglxd != '') {
        $.ajax({
            async: false,
            url: '/api/weaWorkflowActionApi/getFqpbTbjzrq',
            data: {cglxd: cglxd},
            type: "get",
            dataType: "json",
            success: function (data) {
                datas = data.datas;
            }, error: function (e) {
            }
        });
    }
    return datas;
}

//根据采购立项单、轮次获取下一步操作
function getPbjghqData(cglxd, lc) {
    var datas = {};
    if (cglxd != '') {
        $.ajax({
            async: false,
            url: '/api/weaWorkflowActionApi/getPbjghqData',
            data: {cglxd: cglxd, lc: lc},
            type: "get",
            dataType: "json",
            success: function (data) {
                datas = data.datas;
            }, error: function (e) {
            }
        });
    }
    return datas;
}

//根据采购立项单、轮次获取流程状态
function getCglxWfStatus(cglxd) {
    var status = '';
    if (cglxd != '') {
        $.ajax({
            async: false,
            url: '/api/weaWorkflowActionApi/getCglxWfStatus',
            data: {cglxd: cglxd},
            type: "get",
            dataType: "json",
            success: function (data) {
                status = data.currentnodetype;
            }, error: function (e) {
            }
        });
    }
    return status;
}

//根据打分表是否全部归档判断评标结果会签按钮是否可用
function getDfbData(cglxd, lc) {
    var datas = {};
    if (cglxd != '') {
        $.ajax({
            async: false,
            url: '/api/weaWorkflowActionApi/getDfbData',
            data: {cglxd: cglxd, lc: lc},
            type: "get",
            dataType: "json",
            success: function (data) {
                datas = data.datas;
            }, error: function (e) {
            }
        });
    }
    return datas;
}

//根据采购立项单获取资格预审通过的供应商数量
function getZgysDtlCounts(cglxd) {
    var datas = {};
    if (cglxd != '') {
        $.ajax({
            async: false,
            url: '/api/weaWorkflowActionApi/getZgysDtlCounts',
            data: {cglxd: cglxd},
            type: "get",
            dataType: "json",
            success: function (data) {
                datas = data.datas;
            }, error: function (e) {
            }
        });
    }
    return datas;
}

//根据采购立项单将见证人和监督人插入到人员在线表中
function getKbszMainData(cglxd, lc) {
    var datas = {};
    if (cglxd != '') {
        $.ajax({
            async: false,
            url: '/api/weaWorkflowActionApi/getKbszMainData',
            data: {cglxd: cglxd, lc: lc},
            type: "get",
            dataType: "json",
            success: function (data) {
                datas = data.datas;
            }, error: function (e) {
            }
        });
    }
    return datas;
}

//根据requestid获取发起决策数据
function getFqjcData(cglxd, lc) {
    var datas = {};
    if (cglxd != '') {
        $.ajax({
            async: false,
            url: '/api/weaWorkflowActionApi/getFqjcData',
            data: {cglxd: cglxd, lc: lc},
            type: "get",
            dataType: "json",
            success: function (data) {
                datas = data.datas;
            }, error: function (e) {
            }
        });
    }
    return datas;
}

//根据表名字段名获取workflowid和fieldid
function getFieldid(formtable, fieldname) {
    var fieldid = "";
    $.ajax({
        async: false,
        url: '/api/weaWorkflowActionApi/getFieldid',
        data: {formtable: formtable, fieldname: fieldname},
        type: "get",
        dataType: "json",
        success: function (data) {
            fieldid = data.fieldid;
        }, error: function (e) {
        }
    });
    return fieldid;
}

//根据表名字段名获取workflowid
function getWorkflowid(formtable) {
    var workflowid = "";
    $.ajax({
        async: false,
        url: '/api/weaWorkflowActionApi/getWorkflowid',
        data: {formtable: formtable},
        type: "get",
        dataType: "json",
        success: function (data) {
            workflowid = data.workflowid;
        }, error: function (e) {
        }
    });
    return workflowid;
}

//根据表名字段名获取workflowid
function getRwdId2Cglx(cglxd) {
    var datas = getCglxd2Status(cglxd, '', 'xmlb');
    var xmlb_workflowid = getWorkflowid("xmlb");
    var cglxd_xmlb_fieldid = getFieldid("xmlb", "cglxd");
    var status = datas.currentnodetype;
    if (status == '') {
        var url = "/spa/workflow/static4form/index.html?#/main/workflow/req?iscreate=1&workflowid=" + xmlb_workflowid + "&" + cglxd_xmlb_fieldid + "=" + cglxd;
        window.open(url);
    } else if (status == '3') {
        alert("本次项目流标已经完成");
    } else {
        alert("本次项目流标正在进行中");
    }

    /*$.ajax({
         async: false,
         url: '/api/weaWorkflowActionApi/getRwdId2Cglx',
         data: {cglxd: cglxd, table: 'zbcglx'},
         type: "get",
         dataType: "json",
         success: function (data) {
             $('#zbggbtn2').addClass('disabled'); //禁用 --变灰
             $('#zgysbtn1').addClass('disabled'); //禁用 --变灰
             $('#dmdyqbtn1').addClass('disabled'); //禁用 --变灰
             $('#dycqbtn1').addClass('disabled'); //禁用 --变灰
             $('#dycqbtn3').addClass('disabled'); //禁用 --变灰
             $('#onegystbbtn1').addClass('disabled'); //禁用 --变灰
             $('#twogystbbtn1').addClass('disabled'); //禁用 --变灰
             $('#threegystbbtn1').addClass('disabled'); //禁用 --变灰
             $('#fourgystbbtn1').addClass('disabled'); //禁用 --变灰
             $('#fivegystbbtn1').addClass('disabled'); //禁用 --变灰
             $('#onekbbtn5').addClass('disabled'); //禁用 --变灰
             $('#twokbbtn5').addClass('disabled'); //禁用 --变灰
             $('#threekbbtn5').addClass('disabled'); //禁用 --变灰
             $('#fourkbbtn5').addClass('disabled'); //禁用 --变灰
             $('#fivekbbtn5').addClass('disabled'); //禁用 --变灰
             $('#threekbbtn5').addClass('disabled'); //禁用 --变灰
             $('#onepbbtn1').addClass('disabled'); //禁用 --变灰
             $('#twopbbtn1').addClass('disabled'); //禁用 --变灰
             $('#threepbbtn1').addClass('disabled'); //禁用 --变灰
             $('#fourpbbtn1').addClass('disabled'); //禁用 --变灰
             $('#fivepbbtn1').addClass('disabled'); //禁用 --变灰
             $('#onepbbtn4').addClass('disabled'); //禁用 --变灰
             $('#twopbbtn4').addClass('disabled'); //禁用 --变灰
             $('#threepbbtn4').addClass('disabled'); //禁用 --变灰
             $('#fourpbbtn4').addClass('disabled'); //禁用 --变灰
             $('#fivepbbtn4').addClass('disabled'); //禁用 --变灰
             $('#cgjcbtn1').addClass('disabled'); //禁用 --变灰
             $('#cgjcbtn3').addClass('disabled'); //禁用 --变灰
         }, error: function (e) {
         }
     });*/
}

//根据采购立项单判断招采是否转竞价
function getCglx2Jjlx(cglxd) {
    var datas = {};
    $.ajax({
        async: false,
        url: '/api/weaWorkflowActionApi/getCglx2Jjlx',
        data: {cglxd: cglxd},
        type: "get",
        dataType: "json",
        success: function (data) {
            datas = data.datas;
        }, error: function (e) {
        }
    });
    return datas;
}

//判断参数日期是否大于当前日期
function isThanCurDate(date) {
    var flag = false;
    $.ajax({
        async: false,
        url: '/api/weaWorkflowActionApi/isThanCurDate',
        data: {date: date},
        type: "get",
        dataType: "json",
        success: function (data) {
            flag = data.flag;
        }, error: function (e) {
        }
    });
    return flag;
}

//获取竞价立项信息
function getjjlxinfo(jjlxd, status) {
    var jjcglx_workflowid = getWorkflowid("jjcglx");
    $("#jjlxbtn").attr("style", "display:block;");
    if (status == '') {
        var jjlximg = "../images/begin.png";
        $('#cglxbtn').addClass('disabled'); //禁用 --变灰
    } else if (status < 3) {
        var jjlximg = status < 3 ? "../images/begin.png" : "../images/ok.png";
        var url = "/spa/workflow/static4form/index.html?#/main/workflow/req?workflowid=" + jjcglx_workflowid + "&requestid=" + jjlxd;
        $("#jjlxbtn1").attr("href", url);
    } else {
        var jjlximg = status < 3 ? "../images/begin.png" : "../images/ok.png";
        var url = "/spa/workflow/static4form/index.html?#/main/workflow/req?workflowid=" + jjcglx_workflowid + "&requestid=" + jjlxd + "&ismonitor=1";
        $("#jjlxbtn1").attr("href", url);
    }
    changeAttr();
    $("#jjlx").children("div").children("img").attr("src", jjlximg);
    return status;
}

//获取供应商邀请回执个数，查看邀请回执各个数，回执完成个数
function getGysyqCounts(jjlxd) {
    var datas = {};
    $.ajax({
        async: false,
        url: '/api/weaWorkflowActionApi/getGysyqCounts',
        data: {jjlxd: jjlxd},
        type: "get",
        dataType: "json",
        success: function (data) {
            datas = data.datas;
        }, error: function (e) {
        }
    });
    return datas;
}

//根据公布结果获取提交报价明细的供应商
function getGysPirceDtl(jjlxd) {
    var datas = {};
    $.ajax({
        async: false,
        url: '/api/weaWorkflowActionApi/getGysPirceDtl',
        data: {jjlxd: jjlxd},
        type: "get",
        dataType: "json",
        success: function (data) {
            datas = data.datas;
        }, error: function (e) {
        }
    });
    return datas;
}

//根据公布结果获取提交报价明细的供应商
function getPublishResult(jjlxd) {
    var datas = {};
    $.ajax({
        async: false,
        url: '/api/weaWorkflowActionApi/getGysPirceDtl',
        data: {cglxd: jjlxd},
        type: "get",
        dataType: "json",
        success: function (data) {
            datas = data.datas;
        }, error: function (e) {
        }
    });
    return datas;
}

/*供应商邀请*/
function getgysyqinfo(cglxd) {
    $("#gysyqbtn").attr("style", "display:block;");
    $("#initgysyq").remove();
    var datas = getCglx2Jjlx(cglxd);
    var jjlxd = datas.requestid;
    var datas1 = getCglxd2Status(jjlxd, '', 'gysyqjj');
    var requestid = datas1.requestid;
    var status = datas1.currentnodetype;
    var gysyqjj_workflowid = getWorkflowid("gysyqjj");
    var gysyqjj_fieldid = getFieldid("gysyqjj", "cglxd");
    if (status == '') {
        var gysyqimg = "../images/begin.png";
        var url = "/spa/workflow/static4form/index.html?#/main/workflow/req?iscreate=1&workflowid=" + gysyqjj_workflowid + "&" + gysyqjj_fieldid + "=" + jjlxd;
        $("#gysyqbtn1").attr("href", url);
        $("#gysyqbtn2").addClass('disabled'); //禁用 --变灰
    } else {
        var gysyqimg = status < 3 ? "../images/begin.png" : "../images/ok.png";
        $("#gysyqhzbtn").attr("style", "display:block;");
        $("#initgysyqhz").remove();
        var gysyqhzimg = status < 3 ? "../images/begin.png" : "../images/ok.png";
        var data = getGysyqCounts(jjlxd);
        var totalCounts = data.totalCounts;
        var viewCounts = data.viewCounts;
        var compCounts = data.compCounts;
        var newsrc1 = "/spa/cube/index.html#/main/cube/search?customid=75591&cglxd=" + jjlxd;
        var newsrc2 = "/spa/cube/index.html#/main/cube/search?customid=75598&cglxd=" + jjlxd;
        var newsrc3 = "/spa/cube/index.html#/main/cube/search?customid=75599&cglxd=" + jjlxd;
        var url = "/spa/workflow/static4form/index.html?#/main/workflow/req?workflowid=" + gysyqjj_workflowid + "&requestid=" + requestid + "&ismonitor=1";
        $("#gysyqhzbtn1").attr("data-index", newsrc2);
        $("#gysyqhzbtn1").text(viewCounts);
        $("#gysyqhzbtn2").attr("data-index", newsrc1);
        $("#gysyqhzbtn2").text(totalCounts);
        $("#gysyqhzbtn3").attr("data-index", newsrc3);
        $("#gysyqhzbtn3").text(compCounts);
        $("#gysyqhzbtn4").attr("data-index", newsrc1);
        $("#gysyqhzbtn4").text(totalCounts);
        $('#gysyqbtn1').addClass('disabled'); //禁用 --变灰
        $("#gysyqbtn2").attr("href", url);
    }
    changeAttr();
    $("#gysyq").children("div").children("img").attr("src", gysyqimg);
    $("#gysyqhz").children("div").children("img").attr("src", gysyqhzimg);
    return status;
}

/*供应商在线竞价*/
function getzxjjinfo(cglxd) {
    $("#initgysjj").remove();
    var datas = getCglx2Jjlx(cglxd);
    var begintime = datas.begintime;
    var jjlxd = datas.requestid;
    var status = '';
    $("#jjdt").attr("style", "display:block;");
    $("#ComPriceBeginDateid").text(begintime);//竞价开始时间
    var url = "/interface/cese/duss/bidPriceHall/index.html#/?keyword=" + window.btoa(jjlxd);
    $("#goComPrice").attr("href", url);
    var data = getPublishResult(jjlxd);
    if (data.falg) {
        getbjmxinfo(jjlxd);
        status = 3;
    } else {
        status = 1;
    }
    changeAttr();
    return status;
}

/*报价明细*/
function getbjmxinfo(cglxd) {
    $("#initbjmx").remove();
    $("#bjmxbtn").attr("style", "display:block;");
    var datas = getCglx2Jjlx(cglxd);
    var jjlxd = datas.requestid;
    var data = getGysPirceDtl(jjlxd);
    var totalCounts = data.totalCounts;
    var compCounts = data.compCounts;
    var lc = data.lc;
    var status = "";
    var newsrc1 = "/spa/cube/index.html#/main/cube/search?customid=89501&cglxd=" + jjlxd;
    var newsrc2 = "/spa/cube/index.html#/main/cube/search?customid=89502&cglxd=" + jjlxd;

    $("#bjmxbtn1").attr("data-index", newsrc1);
    $("#bjmxbtn1").text(compCounts);
    $("#bjmxbtn2").attr("data-index", newsrc2);
    $("#bjmxbtn2").text(totalCounts);
    if (totalCounts > 0 && totalCounts == compCounts) {
        getcgjcinfo(cglxd, lc);
    }
    var bjmximg = status < 3 ? "../images/begin.png" : "../images/ok.png";
    changeAttr();
    $("#bjmx").children("div").children("img").attr("src", bjmximg);
}